#include<stdio.h>
#include<unistd.h>
#include<assert.h>
#include<sys/wait.h>
#include<stdlib.h>
int main(){
	pid_t id = fork();
	assert(id>= 0);
	if(!id){
		printf("my child id:%d\n",getpid());
		//execl("/usr/bin/ls","ls","--color=auto","-al",NULL);	
		execlp("ls","ls","--color=auto","-al",NULL);
		perror("execl");
	}
	int status = 0;
	pid_t ret = waitpid(id ,&status, 0);
	assert(ret>= 0);
	if(WIFEXITED(status)){
		printf("child work success exit_code: %d \n",WEXITSTATUS(status));
	} 
	else{
		printf("child work error!!\n");
	}
	return 0;
}
